import java.io.*;

import MyThread.TransactionThread;
import Tools.*;
/**
 * @Author: 0162977
 * @Date: 2020/11/12 14:53
 */
public class MainThread {
    public static void main(String[] args) throws IOException, InterruptedException {
        new Dispatch();
        System.out.println("===========全部准备就绪=============");


        Dispatch.addTransaction(1);  //将事务从T1.txt读入
        Dispatch.addTransaction(2);

        Dispatch.openThread(1);  //为T1创建线程
        Dispatch.openThread(2);

        Thread.sleep(1000);  //休眠1000毫秒，等所有事务结束
        Dispatch.pushDisk();   //把公共内存中的两个块，写回磁盘文件，关闭程序
        System.out.println("----------------------");


    }

}
